{include file="header/index" /}
<div class="container whitebg agreement">
    <form class="form-inline mt15 mb15">
        <div class="form-group">
            <input type="text" id="order_number" class="form-control input-min" placeholder="请输入工单编号">
        </div>
        <div class="form-group">
            <input type="text" id="contract_no" class="form-control input-min" placeholder="请输入合同编号">
        </div>
        <div class="form-group">
            <input type="text" id="username" class="form-control input-min" placeholder="请输入客户姓名">
        </div>
        <div class="form-group">
            <input type="text" id="telphone" class="form-control input-min" placeholder="请输入联系电话">
        </div>
        <div class="form-group">
            <label>下单时间</label>
            <input class="form-control input-time" type="text" id="datetimeStart" readonly class="form_datetime" placeholder="开始时间">
            -
            <input class="form-control input-time" type="text" id="datetimeEnd" readonly class="form_datetime" placeholder="结束时间">
        </div>
        <button type="button" id="search" class="btn btn-default input-Btn">搜索</button>
        <button type="reset" class="btn btn-default input-Btn">清空</button>
    </form>

    <form id="form1"  method="Post">
        <table class="table table-bordered">
            <thead class="thBg">
            <tr>
                <th>工单编号</th>
                <th>工单金额</th>
                <th>业务类型</th>
                <th>合同编号</th>
                <th>合同客户</th>
                <th>客户性质</th>
                <th>服务金额</th>
                <th>设备数量</th>
                <th>设备名称</th>
                <th>下单时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <script id="list-template" type="text/html">
                {{# for(var i=0;i<d.length;i++){  }}
                <tr>
                    <td>{{d[i].order_number}}</td>
                    <td>{{d[i].combo_money}}</td>
                    <td>{{d[i].business_id}}</td>
                    <td>{{d[i].contract_no}}</td>
                    <td>{{d[i].username}}</td>
                    <td>{{d[i].nature}}</td>
                    <td>{{d[i].for_core_cost}}</td>
                    <td>{{d[i].eq_num}}</td>
                    <td>{{d[i].equipments_name}}</td>
                    <td>{{d[i].order_time}}</td>
                    <td>
                        <a href="{:url('Revieworder/details')}?contract_id={{d[i].contract_id}}">查看</a>
                        <a href="{:url('Revieworder/through')}?id={{d[i].work_order_id}}">提交</a>
                        <a href="{:url('Revieworder/refused')}?id={{d[i].work_order_id}}">拒绝</a>
                    </td>
                </tr>
                {{# } }}
            </script>
            <tbody id="list-content"></tbody>
        </table>
    </form>
    <div class="clearfix" style="float:right;margin: 0 auto;">
        <span class="fl mt5" id="count">共{$count}条数据</span><span id="allpage"  class="fl  mr20 mt5"></span><span  class="fl" id="AjaxPage"></span>
    </div>
    <!-- 加载动画 -->
    <div class="spiner-example">
        <div class="sk-spinner sk-spinner-three-bounce">
            <div class="sk-bounce1"></div>
            <div class="sk-bounce2"></div>
            <div class="sk-bounce3"></div>
        </div>
    </div>
</div>

</body>
</html>
<script type="text/javascript">

    function order_sub(id)
    {
        $.getJSON('{:url("Revieworder/through")}', {id:id}, function(data){
            if (data.code == ''){

            }
        });
    }

    Ajaxpage();
    function Ajaxpage(curr){
        $(".spiner-example").css('display','block'); //数据加载完开启动画
        var datetimeStart = $('#datetimeStart').val();
        var datetimeEnd = $('#datetimeEnd').val();
        var contract_no = $('#contract_no').val();
        var order_number = $('#order_number').val();
        var username = $('#username').val();
        var telphone = $('#telphone').val();
        $.getJSON('{:url("Revieworder/index")}', {page: curr || 1,telphone:telphone,username:username,contract_no:contract_no,order_number:order_number,datetimeStart:datetimeStart,datetimeEnd:datetimeEnd}, function(data){
            // console.log(data.data);
            $(".spiner-example").css('display','none'); //数据加载完关闭动画
            if(data.data==''){
                $("#list-content").html('<td colspan="20" style="padding-top:10px;padding-bottom:10px;font-size:16px;text-align:center">暂无数据</td>');
                $('#count').html("共"+data.page.count+"条数据");
                $("#allpage").css('display','none');
                $("#AjaxPage").css('display','none');
            }else{
                var tpl = document.getElementById('list-template').innerHTML;
                laytpl(tpl).render(data.data, function(html){
                    document.getElementById('list-content').innerHTML = html;
                    $('#count').html("共"+data.page.count+"条数据");
                    $("#allpage").css('display','');
                    $("#AjaxPage").css('display','');
                });
                laypage({
                    cont: $('#AjaxPage'),//容器。值支持id名、原生dom对象，jquery对象,
                    pages:data.page.lastPage,//总页数
                    skip: true,//是否开启跳页
                    skin: '#337ab7',//分页组件颜色
                    curr: curr || 1,
                    first: '首页', //若不显示，设置false即可
                    last: '尾页', //若不显示，设置false即可
                    groups: 3,//连续显示分页数
                    jump: function(obj, first){
                        if(!first){
                            Ajaxpage(obj.curr)
                        }
                        $('#allpage').html('，第' + obj.curr + '页，共' + '<i>' + obj.pages + '</i>' + '页');
                        inputlength();
                    }
                });
            }
        });
    }

    //搜索
    $('#search').click(function () {
        // $("#hidden_id_card").val($("#id_card").val());
        // $("#hidden_address").val($("#address").val());
        // $("#hidden_contract_no").val($("#contract_no").val());
        // $("#hidden_username").val($("#username").val());
        Ajaxpage();
    });

    //日期选择
    $("#datetimeStart").datetimepicker({
        language: 'cn',
        format: "yyyy-mm-dd",
        autoclose: true,
        minView: "month",
        maxView: "decade",
        todayBtn: true,
        pickerPosition: "bottom-left"
    }).on("click", function(ev) {
        $("#datetimeStart").datetimepicker("setEndDate", $("#datetimeEnd").val());
    });
    $("#datetimeEnd").datetimepicker({
        language: 'cn',
        format: "yyyy-mm-dd",
        autoclose: true,
        minView: "month",
        maxView: "decade",
        todayBtn: true,
        pickerPosition: "bottom-left"
    }).on("click", function(ev) {
        $("#datetimeEnd").datetimepicker("setStartDate", $("#datetimeStart").val());
    });
    //model高度自适应
    $(document).ready(function() {
        var height = $(window).height() - 120;
        $(".model_contract").css("height", height * 0.9)
    });



</script>